import pickle
import time 
import os
def save(data):
    """将数据追加至已有数据里

    Args:
        data (array): 要追加的数据
    """
    while True:        
        try:
            try:
                with open("./indicator.pkl","rb") as f:
                    indicator_saved = pickle.load(f)
                    
            except Exception as e:
                print(1)
                with open("./indicator.pkl","wb") as f:
                    pickle.dump([],f) 
                    
                
            with open("./indicator.pkl","wb") as f:
                indicator_saved.append(data)
                pickle.dump(indicator_saved,f) 
            break
            
        except Exception as ie:
            print(ie)
            time.sleep(1)